<?
$resources = $this->resources;
$default = $this->default;
$privileges = $this->privileges;

?>

<? foreach ($resources as $resource): ?>
    <?= $resource['description'] ?>
<ul style="list-style: none;">
    <? foreach ($resource['privileges'] as $privilege): ?>
    <li>
        <? $enable = $this->consists($default, 'id', $privilege['id']) ? 'disabled checked' : null ?>
        <? $checked = is_array($privileges) && $this->consists($privileges, 'id', $privilege['id'] ) ? 'checked' : null ?>
        <input type="checkbox" name='privileges[]'
               value="<?= $privilege['id'] ?>" <?= $enable ?> <?= $checked ?> /><?= $privilege['description'] ?>

    </li>
    <? endforeach; ?>
</ul>
<? endforeach; ?>
